<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="index.css" />
  <meta charset="utf-8">
  <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css"> 
  <style>
  i.fa {
    font-size: 200%;
  }
  </style>
  <script src="./tools.js"></script>
  <script src="./index.js"></script>
  
  <script>
  function unloadWindow() {
    console.log("The background music current time is: "+document.getElementById("bgm").currentTime)
    console.log("All the background music time is: "+document.getElementById("bgm").duration)
    
    window.resetCookie("bgmPuaseTime",document.getElementById("bgm").currentTime)
    window.setCookie("path","/")
    // console.log("We save the value of cookie is: "+window.getCookie("bgmPuaseTime"))
  }
  
  function loadWindow() {
    console.log("We get the value of bgm pauseTime is: "+window.getCookie("bgmPuaseTime"))
    
    bgm = document.getElementById("bgm")
    /* to keep frequency */
    bgm.currentTime = Number(window.getCookie("bgmPuaseTime")-0.2)
  }
  </script>
</head>
<body onunload="unloadWindow()" onload="loadWindow()">
  <ul class="navigationBar">
    <li><a id="essay" class="navigationLi" href="./index.html" target="_parent">
      <i class="fa fa-gg"></i><br />随笔</a></li>
      
    <li><a id="experience" class="navigationLi" href="./viewer/code.html" target="_parent">
      <i class="fa fa-star-o"></i><br />经历</a></li>
    
    <li><a id="mail" class="navigationLi" href="./viewer/fiction.html" target="_parent">
    <i class="fa fa-envelope-o"></i><br />邮件</a></li>
    
    <li><a id="sentence" class="navigationLi" href="./viewer/sentence.html" target="_parent">
      <i class="fa fa-code"></i><br />句子</a></li>
  </ul>
  
  <!-- 背景音乐 -->
  <audio id="bgm" controls="controls" autoplay="autoplay" controls="controls" hidden="hidden">
    <source src="./sound/bgsound.mp3" type="audio/mp3">
    <embed height="50px" width="100px" src="./sound/bgsound.mp3">
  </audio>
  
  <script>
      window.lowVolume(document.getElementById("bgm"))
  </script>
  
  <script>
  // console.log(window.parent.location.toString())
  /*
  if (typeof window.BRIGHTNESSMODE === "undefined") window.BRIGHTNESSMODE = 1
  if (window.BRIGHTNESSMODE == 1) chooseColor = "#339393"
  else chooseColor = "#DDD"
  */
  chooseColor = "#339393"
  console.log("The page user stay is: "+window.getFilename(window.parent.location))
  switch (window.getFilename(window.parent.location))
  {
    case "index.html"   : document.getElementById("essay").style.color = chooseColor;break;
    case "code.html"    : document.getElementById("experience").style.color = chooseColor;break;
    case "sispace.html" : document.getElementById("experience").style.color = chooseColor;break;
    case "sayin.html" : document.getElementById("experience").style.color = chooseColor;break;
    case "although.html": document.getElementById("experience").style.color = chooseColor;break;
    case "fiction.html" : document.getElementById("mail").style.color = chooseColor;break;
    case "sentence.html": document.getElementById("sentence").style.color = chooseColor;break;
    case "trans.html"   : document.getElementById("sentence").style.color = chooseColor;break;
  }
  </script>
</body>
</html>